﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassLibrary1;
using System.Net.Sockets;

namespace BoardNetTester
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("THIS IS THE SERVER");
            NetServer myConnection = new NetServer("127.0.0.1");

            byte[,] board = new byte[8, 8];
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    board[i, j] = (Byte)(i*j + j);
                }
            }

            Console.WriteLine("Create the board");
            Console.WriteLine("Print the original board");
            PrintBoard(board);
            Console.WriteLine("Send the board");
            myConnection.SendBoard(board);
            Console.WriteLine("Get the board");
            board = myConnection.GetBoard();
            Console.WriteLine("Print the new board");
            PrintBoard(board);

            Console.ReadKey();
        }

        static void PrintBoard(byte[,] board)
        {
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    Console.Write(" " + board[i,j]);
                }
                Console.WriteLine();
            }
        }
    }
}
